package com.system.healthproject.model.sickuser.controller;

import com.system.healthproject.common.ApiResult;
import com.system.healthproject.model.sickuser.service.PatientBannerService;
import com.system.healthproject.pojo.Banner;
import com.system.healthproject.utils.RedisUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(value = "患者端-banner图",tags = "患者端-banner图")
@RestController
@RequestMapping("/patient")
public class SickPatientBannerController {
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private PatientBannerService patientBannerService;

    @RequestMapping(value = "/selectPatientBanner",method = RequestMethod.POST)
    @ApiOperation(value = "患者端-banner图",notes = "患者可以看到的banner",httpMethod = "post")
    @ResponseBody
    public ApiResult selectPatientBanner(){
       /* Map<String, Object> map = (Map<String, Object>) redisUtil.get(token);
        Integer loginId = (Integer) map.get("loginId");*/
        List<Banner> list =patientBannerService.selectPatientBanner();
        return ApiResult.successWithData("成功",list);
    }

    @RequestMapping(value = "/selectPatientBannerInfo",method = RequestMethod.POST)
    @ApiOperation(value = "患者端-banner图详情",notes = "患者可以看到banner详情",httpMethod = "post")
    @ApiImplicitParam(name = "bannerId",value = "BannerId",paramType = "query",dataType = "int",required = true)
    public ApiResult selectPatientBannerInfo(Integer bannerId){
       /* Map<String, Object> map = (Map<String, Object>) redisUtil.get(token);
        Integer loginId = (Integer) map.get("loginId");*/
        Banner banner =patientBannerService.selectPatientBannerInfo(bannerId);
        return ApiResult.successWithData("成功",banner);
    }
}
